<?php
namespace RMD\AccountBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

use RMD\AccountBundle\Entity\Condition;
use RMD\AccountBundle\Form\DataTransformer\TestTransformer;

class OperationType extends AbstractType
{
	public function buildForm(FormBuilderInterface $builder, array $options) {
		$operations = $options['operations'];
		$choices = array();
		foreach ($operations['statements'] as $key => $operation) {
			$choices[$key] = $operation;
		}
		$builder->add('operation', 'choice', array(
			'choices'   => $choices,
			'required'  => true,
		));
	}

    public function getName() {
        return 'operation';
    }
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => null,//'RMD\AccountBundle\Entity\Condition',
            'intention'  => 'operation_item'
        ));
		//$resolver->setRequired(array('operations'));
		$resolver->setOptional(array('operations', 'segmentOptions'));
    }
}
?>
